Skip to content

Simplify capsule local center calculation in movement#601

Closed
tracygardner wants to merge 1 commit intomainfrom
claude/review-player-shape-physics-ebLq4
Closed

Simplify capsule local center calculation in movement#601
tracygardner wants to merge 1 commit intomainfrom
claude/review-player-shape-physics-ebLq4

Conversation

@tracygardner
Copy link
Copy Markdown
Contributor

@tracygardner tracygardner commented May 4, 2026

Summary

Simplified the capsule local center calculation logic by removing unnecessary character mesh detection and conditional logic.

Key Changes

  • Removed complex isCharacterMesh detection that checked multiple metadata properties and name patterns (including checks for "character" and "liz" in various forms)
  • Replaced conditional capsule local center assignment with a simple fallback: cap.localCenter || flock.BABYLON.Vector3.Zero()
  • The new logic directly uses the capsule's local center if available, otherwise defaults to zero vector

Implementation Details

The previous implementation attempted to differentiate behavior based on whether a model was a character mesh, but this distinction is no longer needed. The simplified approach treats all models uniformly by using the capsule's own local center property when present, which is more maintainable and reduces code complexity.

https://claude.ai/code/session_01HKKt5Tdz6MkqcyV8rLPRP2

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Refined ground detection logic in movement system, which improves how character grounding is determined and affects subsequent movement behavior.

cap.localCenter is always the correct offset from mesh origin to capsule
centre. For meshes whose origin sits at the bbox centre (characters,
primitives) localCenter is zero, so the result is identical to the old
Zero() branch. The name-based character guard was protecting against a
case that never occurs.

https://claude.ai/code/session_01HKKt5Tdz6MkqcyV8rLPRP2
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a6afd421-93c9-42f2-8782-d561cd2a8857

📥 Commits

Reviewing files that changed from the base of the PR and between 4052608 and dd1225d.

📒 Files selected for processing (1)
  • api/movement.js

📝 Walkthrough

Walkthrough

The moveForward function's capsule center selection logic was simplified by removing a conditional that checked mesh "character" status. Now capsuleLocalCenter is directly assigned from cap.localCenter with a fallback to zero vector, changing which capsule shape is used for ground detection.

Changes

Capsule Center Selection Simplification

Layer / File(s) Summary
Core Movement Logic
api/movement.js
moveForward capsule center selection is simplified: capsuleLocalCenter now directly uses cap.localCenter with fallback to zero vector, removing the prior isCharacterMesh conditional check.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

codex

Poem

A capsule's heart, once tangled in code,
Now straightforward, a simpler mode.
No character checks, just vectors true,
Hopping forward—the rabbit approves! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: simplification of the capsule local center calculation logic by removing conditional character-mesh detection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/review-player-shape-physics-ebLq4

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@tracygardner tracygardner deleted the claude/review-player-shape-physics-ebLq4 branch May 6, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants